﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:viewmodel="clr-namespace:DDU.ViewModel;assembly=DDU.ViewModel"
    xmlns:UX="clr-namespace:DDU.UX;assembly=DDU.UX"
    xmlns:Converters="clr-namespace:DDU.Converters;assembly=DDU.Converters"
    x:Class="DDU.Curriculum.Views.SemesterAddView"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False" d:DesignHeight="800" d:DesignWidth="480">

    <phone:PhoneApplicationPage.Resources>
        <Converters:EnumTranslateConverter x:Key="EnumTranslateConverter"/>
    </phone:PhoneApplicationPage.Resources>
    
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush Stretch="Fill" ImageSource="/Assets/back.png"/>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.DataContext>
            <viewmodel:SemesterAddViewModel/>
        </Grid.DataContext>

        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{StaticResource IDS_APP_NAME}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="{StaticResource IDS_SEMESTER_ADD}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>

                <ScrollViewer>
                    <StackPanel>
                        <toolkit:ListPicker ItemsSource="{Binding EnumsOfEducationLevel}" 
                                            SelectedItem="{Binding SemesterToAdd.EducationLevel, Mode=TwoWay}">
                            <toolkit:ListPicker.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Converter={StaticResource EnumTranslateConverter}}" />
                                </DataTemplate>
                            </toolkit:ListPicker.ItemTemplate>
                            <toolkit:ListPicker.FullModeItemTemplate>
                                <DataTemplate>
                                    <TextBlock Margin="0,12" 
                                               Style="{StaticResource PhoneTextTitle2Style}"
                                               Text="{Binding Converter={StaticResource EnumTranslateConverter}}" />
                                </DataTemplate>
                            </toolkit:ListPicker.FullModeItemTemplate>
                        </toolkit:ListPicker>
                        <Grid>
                            <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" 
                                       Text="{StaticResource IDS_SEMESTER_GRADE}"/>
                            <TextBlock Style="{StaticResource PhoneTextNormalStyle}" 
                                       Text="{Binding SemesterToAdd.Grade}" 
                                       HorizontalAlignment="Right"/>
                        </Grid>
                        <Slider Minimum="1"
                                Maximum="9" 
                                Value="{Binding SemesterToAdd.Grade, Mode=TwoWay}" />
                        <toolkit:ListPicker ItemsSource="{Binding EnumsOfHalfTerm}" 
                                            SelectedItem="{Binding SemesterToAdd.Term, Mode=TwoWay}" >
                            <toolkit:ListPicker.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Converter={StaticResource EnumTranslateConverter}}" />
                                </DataTemplate>
                            </toolkit:ListPicker.ItemTemplate>
                        </toolkit:ListPicker>
                        <toolkit:DatePicker Header="{StaticResource IDS_SEMESTER_TERM_BEGINS}"
                                            Value="{Binding SemesterToAdd.StartTime, Mode=TwoWay, StringFormat=\{0:D\}}"/>
                        <toolkit:DatePicker Header="{StaticResource IDS_SEMESTER_TERM_FINISHS}" 
                                            Value="{Binding SemesterToAdd.EndTime, Mode=TwoWay, StringFormat=\{0:D\}}"/>
                    </StackPanel>
                </ScrollViewer>
                <StackPanel Grid.Row="1" Margin="0,12">
                    <TextBlock Style="{StaticResource PhoneTextTitle2Style}" 
                               Text="{StaticResource IDS_SEMESTER_SCHOOL_YEAR}" />
                    <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" 
                               Text="{Binding SemesterToAdd.Year}"/>
                </StackPanel>
            </Grid>

            <StackPanel Grid.Column="1" VerticalAlignment="Bottom">
                <UX:UXPathButton IconPath="{StaticResource PATH_ICON_SUBMIT}"
                                 Command="{Binding AddCommand, Mode=OneWay}" />
                <UX:UXPathButton IconPath="{StaticResource PATH_ICON_CLOSE}" 
                                 Command="{Binding CancelCommand, Mode=OneWay}" 
                                 Padding="13" 
                                 Margin="0,12"/>
            </StackPanel>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>